/*
 * Copyright 2012 yura.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.opu.db.obj.vis.domain.dao;

import java.io.Serializable;
import java.util.List;
import org.opu.db.obj.vis.domain.domains.SerializableEntry;

/**
 *
 * @author yura
 */
public interface AbstractDao<K extends Serializable, T extends SerializableEntry<K>> {

    public abstract T get(K id);

    public abstract List<T> getList();

    /**
     * Persist the given transient instance.
     *
     * @param object the transient instance to persist
     * @return the generated identifier
     */
    public abstract K save(T object);
    
    public abstract void saveAll(List<T> list);

    /**
     * Save or update the given persistent instance, according to its id.
     *
     * @param entity the persistent instance to save or update
     * @throws DataAccessException in case of Hibernate errors
     */
    public abstract void saveOrUpdate(T object);

    /**
     * Delete the given persistent instance.
     *
     * @param entity the persistent instance to delete
     * @throws org.springframework.dao.DataAccessException in case of Hibernate
     * errors
     */
    public abstract void delete(T object);
}
